// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved.
 * Author: Huawei OS Kernel Lab
 * Create: Thu Aug 15 16:14:23 2023
 */

#include <liblinux/unimpl.h>
#include <linux/err.h>

/* arch/xxx/kernel/smp.c */
LIBLINUX_UNIMPL(smp_send_stop);

/* kernel/capability.c */
LIBLINUX_EXPORTED_UNIMPL_RET(file_ns_capable, bool, true);
LIBLINUX_UNIMPL_RET(has_ns_capability, bool, true);
LIBLINUX_UNIMPL_RET(has_ns_capability_noaudit, bool, true);
LIBLINUX_EXPORTED_UNIMPL_RET(ns_capable, bool, true);
LIBLINUX_EXPORTED_UNIMPL_RET(ns_capable_noaudit, bool, true);
LIBLINUX_EXPORTED_UNIMPL_RET(ns_capable_setid, bool, true);
int file_caps_enabled = 1;

/* kernel/cred.c */

/* kernel/fork.c */
LIBLINUX_GPL_EXPORTED_UNIMPL(__mmdrop);
LIBLINUX_UNIMPL_RET(vm_area_alloc, void *, 0);

/* kernel/pid.c */
LIBLINUX_GPL_EXPORTED_UNIMPL(put_pid);
LIBLINUX_GPL_EXPORTED_UNIMPL_RET(pid_vnr, int, 0);

/* kernel/sched/core.c */
LIBLINUX_UNIMPL(dump_cpu_task);
LIBLINUX_UNIMPL(sched_show_task);
LIBLINUX_UNIMPL(resched_cpu);
LIBLINUX_UNIMPL_RET(nr_context_switches, unsigned long long, 0);
#ifdef CONFIG_SMP
LIBLINUX_GPL_EXPORTED_UNIMPL(kick_process);
#endif
LIBLINUX_EXPORTED_UNIMPL(scheduler_tick);
LIBLINUX_EXPORTED_UNIMPL(set_user_nice);
LIBLINUX_EXPORTED_UNIMPL_RET(_cond_resched, int, 0);
LIBLINUX_UNIMPL_RET(cpus_share_cache, bool, true);
LIBLINUX_GPL_EXPORTED_UNIMPL(sched_set_fifo_low);
LIBLINUX_EXPORTED_UNIMPL(__cond_resched_lock);
LIBLINUX_UNIMPL_RET(in_sched_functions, int, 0);
LIBLINUX_UNIMPL(ignore_signals);
LIBLINUX_UNIMPL(set_cpu_sd_state_idle);
LIBLINUX_EXPORTED_UNIMPL_RET(sched_getaffinity, int, 0);
LIBLINUX_EXPORTED_UNIMPL_RET(sched_setaffinity, int, 0);
LIBLINUX_UNIMPL(rt_mutex_setprio);
LIBLINUX_UNIMPL(wake_up_if_idle);
LIBLINUX_EXPORTED_UNIMPL_RET(task_curr, int, 1);
LIBLINUX_UNIMPL(sched_ttwu_pending);
LIBLINUX_UNIMPL(send_call_function_single_ipi);
#if !defined(CONFIG_PREEMPTION) || defined(CONFIG_PREEMPT_DYNAMIC)
LIBLINUX_EXPORTED_UNIMPL_RET(__cond_resched, int, 0);
#endif

/* kernel/sched/loadavg.c */
LIBLINUX_UNIMPL(calc_load_nohz_start);
LIBLINUX_UNIMPL(calc_load_nohz_stop);
LIBLINUX_UNIMPL(calc_global_load);

/* kernel/sched/cputime.c */
LIBLINUX_UNIMPL(account_idle_ticks);
LIBLINUX_UNIMPL(account_process_tick);

/* kenrel/sched/fair.c */
LIBLINUX_UNIMPL(nohz_balance_enter_idle);
LIBLINUX_UNIMPL(update_cpu_load_nohz);

/* kernel/locking/rwsem-XX.c */
LIBLINUX_UNIMPL_RET(rwsem_down_read_failed_killable, void *, ERR_PTR(-ENOSYS));
LIBLINUX_UNIMPL_RET(rwsem_down_write_failed_killable, void *, ERR_PTR(-ENOSYS));

/* for kernel/cpu.c */
LIBLINUX_UNIMPL(cpu_die);
LIBLINUX_UNIMPL_RET(sched_cpu_starting, int, 0);
#ifndef CONFIG_LIBLINUX_HOTPLUG
LIBLINUX_UNIMPL_RET(stop_machine_cpuslocked, int, -1);
#endif

/* drivers/base/power/wakeup.c */
LIBLINUX_EXPORTED_UNIMPL_RET(cpu_topology, int, 0);
LIBLINUX_EXPORTED_UNIMPL_RET(cpufreq_frequency_get_table, int, 0);
LIBLINUX_EXPORTED_UNIMPL_RET(cpufreq_update_policies, int, 0);
struct wakeup_source;
LIBLINUX_EXPORTED_UNIMPL_RET(liblinux_acquire_deleted_ws, struct wakeup_source *, NULL);

#ifdef CONFIG_PCI
EX_SYMBOL(pci_rescan_bus_bridge_resize);
#endif
LIBLINUX_EXPORTED_UNIMPL_RET(pcie_slt_hook_register, int, 0);
EX_SYMBOL(irq_set_msi_desc_off);

/* kernel/pid.c */
LIBLINUX_EXPORTED_UNIMPL_RET(find_task_by_vpid, void *, NULL);

/* kernel/signal.c */
LIBLINUX_EXPORTED_UNIMPL(kernel_sigaction);
LIBLINUX_EXPORTED_UNIMPL_RET(send_sig, int, 0);
LIBLINUX_GPL_EXPORTED_UNIMPL_RET(kill_pid_info_as_cred, int, 0);
LIBLINUX_GPL_EXPORTED_UNIMPL_RET(kill_pid_usb_asyncio, int, 0);
LIBLINUX_EXPORTED_UNIMPL_RET(kill_pid, int, 0);
LIBLINUX_UNIMPL(sigqueue_free);
LIBLINUX_UNIMPL_RET(sigqueue_alloc, void *, NULL);
LIBLINUX_UNIMPL_RET(send_sigqueue, int, 0);

#ifndef CONFIG_LIBLINUX_HOTPLUG
/* kernel/stop_machine.c */
LIBLINUX_UNIMPL(stop_machine_park);
LIBLINUX_UNIMPL(stop_machine_unpark);
#endif

/* kernel/power/runtime.c */
LIBLINUX_UNIMPL(update_pm_runtime_accounting);

LIBLINUX_EXPORTED_UNIMPL(cpu_pm_register_notifier);

/* security/security.c */
LIBLINUX_EXPORTED_UNIMPL_RET(security_context_str_to_sid, int, 0);

EX_SYMBOL(kthread_bind_mask);

LIBLINUX_EXPORTED_UNIMPL_RET(__task_pid_nr_ns, int, 0);
LIBLINUX_EXPORTED_UNIMPL_RET(pid_task, int, 0);
LIBLINUX_EXPORTED_UNIMPL_RET(find_vpid, int, 0);
LIBLINUX_EXPORTED_UNIMPL(mmput);
LIBLINUX_EXPORTED_UNIMPL_RET(get_task_mm, int, 0);
LIBLINUX_EXPORTED_UNIMPL_RET(get_mm_exe_file, int, 0);

EXPORT_SYMBOL(saved_command_line);
EX_SYMBOL(arm_pm_restart);

LIBLINUX_EXPORTED_UNIMPL_RET(get_kernel_build_time, int, 0);

/* for tty */
LIBLINUX_UNIMPL_RET(__group_send_sig_info, int, 0);
LIBLINUX_UNIMPL_RET(is_current_pgrp_orphaned, int, 0);
LIBLINUX_EXPORTED_UNIMPL_RET(kill_pgrp, int, 0);

LIBLINUX_UNIMPL_RET(nr_processes, int, 0);

/* drivers/pps/kapi.c */
LIBLINUX_EXPORTED_UNIMPL_RET(pps_register_source, void *, ERR_PTR(-ENOSYS));
LIBLINUX_EXPORTED_UNIMPL(pps_unregister_source);
LIBLINUX_EXPORTED_UNIMPL(pps_event);
/* net/core/ptp_classifier.c */
LIBLINUX_UNIMPL(ptp_classifier_init);

/* for serial drivers */
LIBLINUX_EXPORTED_UNIMPL_RET(probe_irq_on, unsigned long, 0);
LIBLINUX_EXPORTED_UNIMPL_RET(probe_irq_off, int, 0);
LIBLINUX_GPL_EXPORTED_UNIMPL(register_console);

/* reboot.c */

/* kernel/umh.c */
LIBLINUX_EXPORTED_UNIMPL_RET(call_usermodehelper_setup, void *, NULL);
LIBLINUX_EXPORTED_UNIMPL_RET(call_usermodehelper_exec, int, -EINVAL);
LIBLINUX_EXPORTED_UNIMPL_RET(call_usermodehelper, int, -ENOMEM);
LIBLINUX_UNIMPL_RET(__usermodehelper_disable, int, -EINVAL);

/* kernel/time/posix-cpu-timers.c */
LIBLINUX_UNIMPL(run_posix_cpu_timers);

#ifdef CONFIG_LOCKDEP

/* kernel/printk/printk.c */
int oops_in_progress;
EXPORT_SYMBOL(oops_in_progress);
#endif

#ifdef CONFIG_TRACING
/* fs/splice.c */
LIBLINUX_EXPORTED_UNIMPL_RET(splice_grow_spd, int, 0);
LIBLINUX_EXPORTED_UNIMPL_RET(splice_to_pipe, ssize_t, 0);
LIBLINUX_UNIMPL(splice_shrink_spd);

/* kernel/pid.c */
int pid_max = 0x8000;

/* kernel/printk/printk_safe.c */
LIBLINUX_EXPORTED_UNIMPL(printk_nmi_direct_enter);
LIBLINUX_EXPORTED_UNIMPL(printk_nmi_direct_exit);

/* mm/page_alloc.c */
LIBLINUX_EXPORTED_UNIMPL_RET(get_pfnblock_flags_mask, unsigned long, 0);
# endif

/* security/{}.c */
LIBLINUX_UNIMPL_RET(cap_capable, int, 0);
LIBLINUX_UNIMPL_RET(cap_convert_nscap, int, 0);
LIBLINUX_UNIMPL_RET(cap_settime, int, -EPERM);
LIBLINUX_UNIMPL_RET(cap_inode_getsecurity, int, 0);
LIBLINUX_UNIMPL_RET(cap_inode_need_killpriv, int, 0);
LIBLINUX_UNIMPL_RET(cap_inode_removexattr, int, 0);
LIBLINUX_UNIMPL_RET(cap_inode_setxattr, int, 0);
LIBLINUX_UNIMPL_RET(cap_task_setioprio, int, 0);
LIBLINUX_UNIMPL_RET(cap_inode_killpriv, int, 0);

LIBLINUX_UNIMPL_RET(nr_free_buffer_pages, int, 0);

/* kernel/compat.c */
LIBLINUX_UNIMPL_RET(get_compat_sigevent, int, 0);
